package com.test.designPattern.ch22;

/**
 * @ClassName CustomerFactory
 * @Description TODO
 * @Author 维康
 * @Date 2018/6/13 11:03
 * @Version 1.0
 **/
public class CustomerFactory {
    public static final String[] names = {"Rob", "Joe", "Julie"};

    public static AbstractCustomer getCustomer(String name){
        for (int i = 0; i < names.length; i++) {
            if (names[i].equalsIgnoreCase(name)){
                return new RealCustomer(name);
            }
        }
        return new NullCustomer();
    }
}
